<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>选择框</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <select v-model="selected">
            <option v-for="option in options" v-bind:value="option.value">
                {{option.text}}
            </option>
        </select>
        <span>选择了：{{selected}}</span>
        
        <input type="number" v-model.number="age">
        <input type="text" v-model.trim="msg">
        <button @click="getValue">获取输入值</button>

    </div>
</body>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            selected: 'A',
            options: [
                { text: 'One', value: 'A'},
                { text: 'Two', value: 'B'},
                { text: 'Three', value: 'C'}
            ],
            age: 0,
            msg: ''
        },
        methods: {
            getValue: function(){
                console.log('age: '+this.age+',msg: '+this.msg)
            }
        }
    })
</script>
</html>